home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-apt / examples / gui-inst.py < prev    next >
Encoding:
Python Source  |  2009-03-30  |  642 b   |  28 lines

  1. #!/usr/bin/python
  2. # example how to install in a custom terminal widget
  3. # see also gnome bug: #169201
  4. import pygtk
  5. pygtk.require('2.0')
  6. import gtk
  7.  
  8. import apt.gtk.widgets
  9.  
  10.  
  11. if __name__ == "__main__":
  12.  
  13.     win = gtk.Window()
  14.     progress = apt.gtk.widgets.GtkAptProgress()
  15.     win.set_title("GtkAptProgress Demo")
  16.     win.add(progress)
  17.     progress.show()
  18.     win.show()
  19.  
  20.     cache = apt.cache.Cache(progress.open)
  21.     if cache["2vcard"].isInstalled:
  22.         cache["2vcard"].markDelete()
  23.     else:
  24.         cache["2vcard"].markInstall()
  25.     progress.show_terminal(expanded=True)
  26.     cache.commit(progress.fetch, progress.install)
  27.     gtk.main()
  28.